package ${basepackage}.framework.base.dao;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

import javacommon.xsqlbuilder.XsqlBuilder;

import org.springframework.dao.DataAccessException;

import ${basepackage}.framework.base.page.BaseQuery;
import ${basepackage}.framework.base.page.Page;
import ${basepackage}.framework.base.page.PageRequest;

<#include "/author.include">
public interface EntityDao <E,PK extends Serializable>{

	public E getById(PK id) throws DataAccessException;
	
	public void deleteById(PK id) throws DataAccessException;
	
	/** ������� */
	public void save(E entity) throws DataAccessException;
	
	/** ������� */
	public void update(E entity) throws DataAccessException;

	/** ���id����Ƿ������Ǹ������ */
	public void saveOrUpdate(E entity) throws DataAccessException;

	public boolean isUnique(E entity, String uniquePropertyNames) throws DataAccessException;
	
	/** ����hibernate.flush() ��Щdaoʵ�ֲ���Ҫʵ�ִ���  */
	public void flush() throws DataAccessException;
	
	public List<E> findAll() throws DataAccessException;
	
	public Page findAll(final PageRequest pageRequest);
	
	public Page pageQuery(final String sql,final PageRequest pageRequest);
	
	public Page pageQuery(final String sql,String countQuery,final PageRequest pageRequest);
	
	public XsqlBuilder getXsqlBuilder();
	
	public  Class getEntityClass();
	
	public Page findPage(BaseQuery query);
	
	public List<E> findAllBy(final String propertyName, final Object value);
	
	public E findByProperty(final String propertyName, final Object value);
	
	public void deleteAll(Collection entities);
}
